function addRow(type,values){
    if (values.length>0){
        var tag="td";
        var docHTML="";
        if ( type == "head" ){
            tag="th";
        }
        for (var i=0;i<values.length;i++){
            docHTML+=addHTMLElement(tag,values[i]);
        }
        return addHTMLElement("tr",docHTML);
    }
    return "";
}

function addHTMLElement(anElement,aContent){
    var docHTML=""
    if (anElement != null){
        element=trim(anElement);
        docHTML="<"+element+">"+aContent+"</"+ element.split(" ")[0]+">";
    }
    return docHTML;
}
function drawTableBody(data){
    var tableBody ="";
    if (data.length > 0){
        for (var i=0;i<data.length;i++){
            tableBody+=addRow("body",data[i]);
        }
        tableBody=addHTMLElement("tbody",tableBody);
    }
    return tableBody
}